var dataSource = new Array();
//table的数据源
var table;   //table对象
dataSource = [];
var excelType=0;

function searchList() {
    $.ajax({
        url: root.consignee.getConsigneeApplyByPage,
        cache: false,  //禁用缓存
        type: "POST",
        dataType:'json',
        async:false,
        data: {
            "pageNum":1,
            "pageSize":20,
            applyCustomer:$("#apply_customer").val(),
            applyUser:$("#apply_user").val(),
            applyDateStr:$("#datestr").val(),
            applyDateEnd:$("#dateend").val(),
            consigneeName:$("#consignee_name").val(),
            consigneeTelephone:$("#consignee_telephone").val()
        },

        success: function (data) {
            console.log(data)
            couponlist(data.result);
            $('.M-box3').pagination({
                pageCount: data.totalPage,
                jump: true,
                coping: true,
                prevContent: '上页',
                nextContent: '下页',
                callback: function (api) {
                    console.log(api)
                    $.ajax({
                        url: root.consignee.getConsigneeApplyByPage,
                        cache: false,  //禁用缓存
                        type: "POST",
                        dataType:'json',
                        async:false,
                        data: {
                            "pageNum":api.getCurrent(),//获取当前页码
                            "pageSize":20,
                            applyCustomer:$("#apply_customer").val(),
                            applyUser:$("#apply_user").val(),
                            applyDateStr:$("#datestr").val(),
                            applyDateEnd:$("#dateend").val(),
                            consigneeName:$("#consignee_name").val(),
                            consigneeTelephone:$("#consignee_telephone").val(),
                        },
                        success: function (result) {
                            console.log(result)
                            couponlist(result.result);
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            alert(XMLHttpRequest);
                        }
                    });
                }
            });

        },
        error: function () {
            $.Huimodalalert('失败！',2000);
        }
    });
}
console.log()
// var j = 0;
function couponlist(data){

    var recordList = [];
    if (data && data.length > 0) {
        var curObj = data[0];
        console.log(curObj);
        for (var k in curObj) {
            recordList.push(curObj[k]);
        }
        recordList.reverse();
    }
    console.log(recordList);
    // var j = 0;
    console.log(data)
    sessionStorage.setItem("authorizedUsers", JSON.stringify(data));
    dataSource.splice(0,dataSource.length);//清空数组

    $.each(recordList, function (i, field) {
        // for (key in field){
        // console.log(field)
        var rowData = new Array();
        var fieldNew = field.new;
        var fieldOld = field.oldData;
        /*新数据*/
        rowData.push(fieldNew.change_status);
        rowData.push(fieldNew.consignee_name);
        rowData.push(fieldNew.apply_customer);
        rowData.push(fieldNew.apply_user);
        rowData.push(fieldNew.apply_date);
        rowData.push(fieldNew.audit_user);
        rowData.push(fieldNew.audit_date);
        rowData.push(fieldNew.audit_status);
        rowData.push("<p class='remarkP'><span class='remarkA' href='#' style='color: #000;'>"+fieldNew.remarks+"</span></p>");
        rowData.push("审核");
        rowData.push(fieldNew.consignee_telephone);
        rowData.push(fieldNew.consignee_fixedphone);
        rowData.push(fieldNew.consignee_idcard);

        rowData.push(fieldNew.idCardPath); //身份证图片正面
        rowData.push(fieldNew.idCardOtherPath); //身份证图片反面
        rowData.push(fieldNew.instructionsPath); //授权说明书图片
        /*旧数据*/
        rowData.push(fieldOld.consignee_name == undefined ? "" : fieldOld.consignee_name); //url
        rowData.push(fieldOld.consignee_telephone);
        rowData.push(fieldOld.consignee_fixedphone);
        rowData.push(fieldOld.consignee_idcard);
        rowData.push(fieldNew.audit_consignee_id);
        rowData.push(fieldOld.authorized_consignee_id);

        // console.log(fieldNew.apply_date);
        rowData.push("取消");
        dataSource.push(rowData);
        // }

    });
    initDataTable(dataSource);

    function initDataTable(dataSource) {
        console.log(dataSource)
        var dttable = $('#datatable').dataTable(); // 初始化dataTable，清空上一个值
        dttable.fnClearTable(); //清空一下table
        dttable.fnDestroy(); //还原初始化了的datatable
        $("#datatable").DataTable({
            "order": [[ 7, "desc" ]],
            "autoWidth": false,
            "ordering": false,
            "searching": false,
            "paging": false,
            "retrieve": true,
            "destroy": true,
            "bAutoWidth": true,
            "bLengthChange": true,
            "aLengthMenu": [50, 25, 10, 5],
            "oLanguage": {
                "sLengthMenu": "每页显示 _MENU_ 条记录",
                "sZeroRecords": "抱歉， 没有找到",
                "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                "sInfoEmpty": "没有数据",
                "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "前一页",
                    "sNext": "后一页",
                    "sLast": "尾页"
                },
                "sZeroRecords": "没有检索到数据",
                "sProcessing": "<img src='./loading.gif' />"
            },
            data: dataSource,
            columnDefs: [
                {
                    "visible": true,
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if(row[7]==10){
                            val='<div>'+row[8]+'</div>' +
                                '<div><a class="powerButton 168" style="margin-right: 20px"><span class="list" id="'+row[20]+'" onclick="editor('+row[20]+')">编辑</span></a></div>'
                        } else if(row[7]==30){
                            val='<div>'+row[8]+'</div>' +
                                '<div><a class="powerButton 168" style="margin-right: 20px"><span class="list" id="'+row[20]+'" onclick="editor('+row[20]+')">编辑</span></a></div>'
                        }else if(row[7]==40) {
                            val = '<div>' + row[8] + '</div>' +
                                '<div><a class="powerButton 168" style="margin-right: 20px"><span class="list" id="' + row[20] + '" onclick="editor(' + row[20] + ')">编辑</span></a></div>'
                        }
                        else if(row[7]==20) {
                            val = '<div>----</div>';
                        }
                        return val;
                    },
                    "targets":8
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if(row[7]==20){/*<div class="hidden">'+row[5]+'</div>*/
                            val='---'
                        }else {
                            val=row[5]
                        }
                        return val;

                    },
                    "targets":5
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if(row[7]==20){
                            val='---'
                        }else {
                            var val = '';
                            // console.log(row[6]);
                            var date = row[6];
                            var split = date.split(" ");
                            // console.log(split)
                            val = split[0] + '<br/>' + split[1];

                        }
                        return val;

                    },
                    "targets":6
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if(row[0]==10){
                            val='新增'
                        } else if(row[0]==20){
                            val='修改'
                        }
                        return val;
                    },
                    "targets":0
                },

                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if(row[7]==10){
                            val='通过'
                        } else if(row[7]==20){
                            val='待审核'
                        }
                        else if(row[7]==30){
                            val='不通过'
                        }
                        else if(row[7]==40){
                            val='已取消'
                        }
                        return val;
                    },
                    "targets":7
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        // console.log(row[4]);
                        var date = row[4];
                        var split = date.split(" ");
                        // console.log(split)
                        val = split[0] + '<br/>' + split[1];
                        return val;
                    },
                    "targets":4
                },
               /* {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if(row[13]==''||row[14]==''||row[15]==''){

                        }
                        if(row[0]==10){

                            val='<div style="float: left"><p id="consignee_name">'+row[1]+'</p><p id="consignee_telephone">'+row[10]+'</p><p id="consignee_fixedphone">'+row[11]+'</p><p id="consignee_idcard">'+row[12]+'</p><img width="30" onclick="picShow(\'查看图片\',\'../../html/goods/picShow.html\',\''+row[13]+'\',\'500\',\'300\',\'110\')" height="30"  id="idCardPath" src=" '+row[13]+' ">&nbsp;<img onclick="picShow(\'查看图片\',\'../../html/goods/picShow.html\',\''+row[14]+'\',\'500\',\'300\',\'110\')" width="30" height="30" id="idCardOtherPath" src=" '+row[14]+' " >&nbsp;<img onclick="picShow(\'查看图片\',\'../../html/goods/picShow.html\',\''+row[15]+'\',\'500\',\'300\',\'110\')" width="30" height="30" id="instructionsPath" src="'+row[15]+'"></div>'
                        } else if(row[0]==20){
                            val="<div><label style='width:33px;margin-left:5px;padding-right:14px;height:24px;display:block;float:left; no-repeat left top;line-height:22px;color:#616161;padding-left:18px;margin-right:5px;background-color: #ccc;margin-left:auto;margin-right:auto;;'>变更</label></div><div><p id='consignee_name'>"+row[1]+"</p><p id='consignee_telephone'>"+row[10]+"</p><p id='consignee_fixedphone'>"+row[11]+"</p><p id='consignee_idcard'>"+row[12]+"</p><img onclick='picShow(\"查看图片\",\"../../html/goods/picShow.html\",\""+row[13]+"\",\"500\",\"300\",\"110\")' width='30' height='30' id='idCardPath' src=' "+row[13]+" '>&nbsp;<img onclick='picShow(\"查看图片\",\"../../html/goods/picShow.html\",\""+row[14]+"\",\"500\",\"300\",\"110\")' width='30' height='30' id='idCardOtherPath' src='"+row[14]+"'>&nbsp;<img onclick='picShow(\"查看图片\",\"../../html/goods/picShow.html\",\""+row[15]+"\",\"500\",\"300\",\"110\")' width='30' height='30' id='instructionsPath' src='"+row[15]+"'></div></div><div><label style=' width:33px;height:24px;display:block;float:left; no-repeat left top;line-height:22px;color:#616161;padding-left:18px;margin-right:5px;background-color: #ccc;text-align:center;margin-left:5px;padding-right:14px;margin-left:auto;margin-right:auto;'>原有</label><div style='float: left'><p id='consignee_name'>"+row[1]+"</p><p id='consignee_telephone'>"+row[17]+"</p><p id='consignee_fixedphone'>"+row[18]+"</p><p id='consignee_idcard'>"+row[19]+"</p></div></div>"
                        }
                        return val;
                    },
                    "targets":1
                },*/

                {
                    "render": function (data, type, row, meta) {
                        if (row[17] == undefined) {
                            row[17] = "";
                        }
                        if (row[18] == undefined) {
                            row[18] = "";
                        }
                        if (row[19] == undefined) {
                            row[19] = "";
                        }
                        if(row[0]==10){
                            var val = '<div style="float: left"><p id="consignee_name">' + row[1] + '</p><p id="consignee_telephone">' + row[10] + '</p><p id="consignee_fixedphone">' + row[11] + '</p><p id="consignee_idcard">' + row[12] + '</p>';
                            if(row[13] != "" && row[13] != null){
                                val += '<img onclick="picShow(\'查看图片\',\'../../html/goods/picShow.html\',\'' + row[13] + '\',\'500\',\'300\',\'110\')" width="30" height="30" id="idCardOtherPath" src="' + row[13] + ' " >&nbsp;';
                            }
                            if (row[14] != "" && row[14] != null) {
                                val += '<img onclick="picShow(\'查看图片\',\'../../html/goods/picShow.html\',\'' + row[14] + '\',\'500\',\'300\',\'110\')" width="30" height="30" id="idCardOtherPath" src=" ' + row[14] + '">&nbsp;';
                            }
                            if (row[15] != "" && row[15] != null) {
                                val += '<img onclick="picShow(\'查看图片\',\'../../html/goods/picShow.html\',\'' + row[15] + '\',\'500\',\'300\',\'110\')" width="30" height="30" id="idCardOtherPath" src=" ' + row[15] + '">';
                            }
                            val += '</div>';
                        } else if(row[0]==20){
                            var val = '<div><label style="width:33px;margin-left:5px;padding-right:14px;height:24px;display:block;float:left; no-repeat left top;line-height:22px;color:#616161;padding-left:18px;margin-right:5px;background-color: #ccc;margin-left:auto;margin-right:auto;;">变更</label></div><div><p id="consignee_name">' + row[1] + '</p><p id="consignee_telephone">' + row[10] + '</p><p id="consignee_fixedphone">' + row[11] + '</p><p id="consignee_idcard">' + row[12] + '</p>';
                            if(row[13] != "" && row[13] != null){
                                val += '<img onclick="picShow(\'查看图片\',\'../../html/goods/picShow.html\',\'' + row[13] + '\',\'500\',\'300\',\'110\')" width="30" height="30" id="idCardOtherPath" src="' + row[13] + ' " >&nbsp;';
                            }
                            if (row[14] != "" && row[14] != null) {
                                val += '<img onclick="picShow(\'查看图片\',\'../../html/goods/picShow.html\',\'' + row[14] + '\',\'500\',\'300\',\'110\')" width="30" height="30" id="idCardOtherPath" src=" ' + row[14] + '">&nbsp;';
                            }
                            if (row[15] != "" && row[15] != null) {
                                val += '<img onclick="picShow(\'查看图片\',\'../../html/goods/picShow.html\',\'' + row[15] + '\',\'500\',\'300\',\'110\')" width="30" height="30" id="idCardOtherPath" src=" ' + row[15] + '">';
                            }
                            val += '</div></div><div><label style=" width:33px;height:24px;display:block;float:left; no-repeat left top;line-height:22px;color:#616161;padding-left:18px;margin-right:5px;background-color: #ccc;text-align:center;margin-left:5px;padding-right:14px;margin-left:auto;margin-right:auto;">原有</label><div><p id="consignee_name">' + row[16] + '</p><p id="consignee_telephone">' + row[17] + '</p><p id="consignee_fixedphone">' + row[18] + '</p><p id="consignee_idcard">' + row[19] + '</p></div></div>';
                        }
                        return val;
                    },
                    "targets":1
                },
                {
                    "render": function (data, type, row, meta) {
                        var val='';
                        if(row[7]==20){
                            val = '<div class="action" id="action'+row[7]+'"><a class="powerButton 169" style="margin-right: 14px"><span class="list" id="'+row[20]+'" onclick="confirm('+row[20]+')">审核</span></a>'+
                                '<a  class="powerButton 169" style="margin-right: 0px"><span class="list" id="'+row[20]+'" onclick="confirm2('+row[20]+')">取消</span></a>';


                        }
                        else if(row[7]==10){
                            val='<div class="action" id="action'+row[7]+'"><span class="list powerButton 169" style="color:#aaaaaa">审核</span>';



                        }
                        else if(row[7]==30){

                            val='<span class="list powerButton 169" style="color:#aaaaaa">审核</span></div>' ;


                        }


                        return val;
                    },
                    "targets":9
                }



            ]
        });
//权限控制函数
        power()
    };
}
//待审核弹框
var index=0;
function confirm(id,name) {
    var popEle = $('#chuliPop');
    var curInd = layer.confirm(
        '<select  id="city" class="city pickout" style=" width:200px; float: left"> <option data-icon="&spades;" value="10">审核通过</option> <option data-icon="&spades;" value="30">审核不通过</option></select>'+'<br/>'+
        '<textarea id="hresults" style="  width:200px;height:100px;resize: none; float:left" maxlength="50"  placeholder="请输入备注说明（客户可见）,最多支持50字符"></textarea>', {title:'提示',btn: ['取消', '确认']}, function(index){

            layer.close(curInd);

        },function(){
            /*console.log(1)
            var selV = $('#city option:selected').text();
            var sel = $('#city').val();
            var inV = $('#hresults').val();*/

            finish2(id,curInd,name)
            layer.close(curInd);
            //var inv = $("#audit_status").val();


        });
}
//第二个确认
function finish2(id,selV,inV){
    var target = document.getElementById(''+id+'');
    var sel = $('#city').val();
    var inV = $('#hresults').val();

    console.log(inV)
    console.log(sel)
    if (sel == 10) {
        target.parentElement.parentElement.parentElement.previousElementSibling.previousElementSibling.innerHTML = '通过';
    } else {
        target.parentElement.parentElement.parentElement.previousElementSibling.previousElementSibling.innerHTML = '不通过'
    }
    target.parentElement.parentElement.parentElement.previousElementSibling.innerHTML = inV;

    var reason=$('#reason'+id+'').val();

    var target = document.getElementById(''+id+'');
    // var auditUser = target.parentElement.parentElement.parentElement.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.lastElementChild.innerHTML

    //拿到接口里面的数据
    var authorizedUsers = JSON.parse(sessionStorage.getItem("authorizedUsers"));
    var authorData = {}
    $.each(authorizedUsers, function (i, field) {
        for (key in field){
            var fieldNew = field[key].new;
            var fieldOld = field[key].oldData;
            console.log(fieldNew)
            console.log(fieldOld)
            if (fieldNew.audit_consignee_id == id) {
                authorData = {
                    customer_code: fieldNew.customer_code,
                    apply_customer: fieldNew.apply_customer,
                    consignee_telephone: fieldNew.consignee_telephone,
                    consignee_fixedphone: fieldNew.consignee_fixedphone,
                    consignee_idcard: fieldNew.consignee_idcard,
                    consignee_name: fieldNew.consignee_name,
                    apply_user: fieldNew.apply_user,
                    idCardPath:fieldNew.idCardPath,//非必选，身份证正面图片
                    idCardOtherPath:fieldNew.idCardOtherPath,//非必选，身份证反面图片
                    instructionsPath:fieldNew.instructionsPath,//非必选，授权说明书图片
                    authorized_consignee_id: fieldOld.authorized_consignee_id,
                    audit_user: JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.name,
                    change_status:fieldNew.change_status
                }
            }
        }
    })



    if(reason!=''){
        $.ajax({
            url:root.consignee.auditConsigneeInfo ,
            cache: false,  //禁用缓存
            type: "POST",
            dataType:'json',
            async:false,
            data: {
                customerCode:authorData.customer_code,//客户代码
                customerName:authorData.apply_customer,//客户名称
                consigneeTelephone:authorData.consignee_telephone,//手机号
                consigneeFixedphone:authorData.consignee_fixedphone,//固定电话
                consigneeIdcard:authorData.consignee_idcard,//身份证
                consigneeName:authorData.consignee_name,//授权收货人名称
                applyUser:authorData.apply_user,//申请人
                consigneeIdcardImg:authorData.idCardPath,//非必选，身份证正面图片
                consigneeIdcardImgOther:authorData.idCardOtherPath,//非必选，身份证反面图片
                authorizedInstruction:authorData.instructionsPath,//非必选，授权说明书图片
                authorizedConsigneeId:authorData.authorized_consignee_id,//授权收货人id
                auditConsigneeId:id,//审核信息id
                auditUser:authorData.audit_user,//审核人
                remarks:inV,//备注
                auditStatus:sel,//审核状态
                changeStatus:authorData.change_status//变更类型


            },
            success: function (data) {
                searchList();
                target.setAttribute("onclick", 'confirm('+id+')')

            },
            error: function () {
                $.Huimodalalert('失败！',2000);

            }
        })}
    else{
        $.Huimodalalert('处理结果不能为空！',2000);
    };
    layer.close(index);
}


//编辑
//弹框
var index=0;
function editor(id,name) {
    var popEle = $('#chuliPop');
    var target = document.getElementById(''+id+'');
    var common = target.parentElement.parentElement.previousElementSibling.lastElementChild.lastElementChild.innerHTML

    var cu = layer.confirm('<textarea id="remarks" style="width:200px;height:100px;resize: none;" maxlength="50" placeholder="请输入备注说明（客户可见）,最多支持50字符" ></textarea>', {title:'编辑备注',btn: ['取消', '确认']}, function(index){

        layer.close(cu);
    },function(){
        finish3(id,cu,name)
        var inv = $("#remarks").val();
        layer.close(cu);

    });
    $("#remarks").val(common)
}
//第二个
function finish3(id,val){
    var target = document.getElementById(''+id+'');
    var remarks = $("#remarks").val();
    console.log(remarks)
    console.log(id)
    target.parentElement.parentElement.previousElementSibling.lastElementChild.lastElementChild.innerHTML = remarks;

    var reason=$('#reason'+id+'').val();
    if(reason!=''){
        $.ajax({
            url: root.consignee.updateRemarksById,
            cache: false,  //禁用缓存
            type: "POST",
            dataType:'json',
            async:false,
            data: {
                auditConsigneeId: id,
                remarks: remarks
            },
            success: function (data) {
                target.onclick = null;
                target.setAttribute("onclick", 'editor('+id+')')
                // target.parentElement.parentElement.parentElement.previousElementSibling.previousElementSibling.previousElementSibling
            },
            error: function () {
                $.Huimodalalert('失败！',2000);
            }
        })}
    else{
        $.Huimodalalert('处理结果不能为空！',2000);
    };
    layer.close(index);
}
//取消弹框
var index=0;
function confirm2(id,val) {
    var curInd = layer.confirm('<span id="status" style="width:200px;height:100px;resize: none;" maxlength="200" >是否取消？</span>', {title:'提示',btn: ['确定', '取消']}, function(index){

        finish5(id,curInd,val)
        var inV = $('#hresults').val();
        layer.close(curInd);
    },function(){
        layer.close(curInd);

    });
}
//第一个
function finish5(id,inV,name){
    var inV = $('#hresults').val();
    var target = document.getElementById(''+id+'');

    target.parentElement.parentElement.parentElement.previousElementSibling.previousElementSibling.innerHTML = '已取消';

    var reason=$('#reason'+id+'').val();

    var target = document.getElementById(''+id+'');
    //拿到接口里面的数据
    var authorizedUsers = JSON.parse(sessionStorage.getItem("authorizedUsers"));
    var authorData = {}
    $.each(authorizedUsers, function (i, field) {
        for (key in field){
            var fieldNew = field[key].new;
            var fieldOld = field[key].oldData;
            // console.log(fieldNew)
            // console.log(fieldOld)
            if (fieldNew.audit_consignee_id == id) {
                authorData = {
                    customer_code: fieldNew.customer_code,
                    apply_customer: fieldNew.apply_customer,
                    consignee_telephone: fieldNew.consignee_telephone,
                    consignee_fixedphone: fieldNew.consignee_fixedphone,
                    consignee_idcard: fieldNew.consignee_idcard,
                    consignee_name: fieldNew.consignee_name,
                    apply_user: fieldNew.apply_user,
                    idCardPath:fieldNew.idCardPath,//非必选，身份证正面图片
                    idCardOtherPath:fieldNew.idCardOtherPath,//非必选，身份证反面图片
                    instructionsPath:fieldNew.instructionsPath,//非必选，授权说明书图片
                    authorized_consignee_id: fieldOld.authorized_consignee_id,
                    audit_status:fieldNew.audit_status,
                    audit_user: JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.name,
                    change_status:fieldNew.change_status
                }
            }
        }
    })



    if(reason!=''){
        $.ajax({
            url:root.consignee.auditConsigneeInfo ,
            cache: false,  //禁用缓存
            type: "POST",
            dataType:'json',
            async:false,
            data: {
                customerCode:authorData.customer_code,//客户代码
                customerName:authorData.apply_customer,//客户名称
                consigneeTelephone:authorData.consignee_telephone,//手机号
                consigneeFixedphone:authorData.consignee_fixedphone,//固定电话
                consigneeIdcard:authorData.consignee_idcard,//身份证
                consigneeName:authorData.consignee_name,//授权收货人名称
                applyUser:authorData.apply_user,//申请人
                consigneeIdcardImg:authorData.idCardPath,//非必选，身份证正面图片
                consigneeIdcardImgOther:authorData.idCardOtherPath,//非必选，身份证反面图片
                authorizedInstruction:authorData.instructionsPath,//非必选，授权说明书图片
                authorizedConsigneeId:authorData.authorized_consignee_id,//授权收货人id
                auditConsigneeId:id,//审核信息id
                auditUser:authorData.audit_user,//审核人
                remarks:inV,//备注
                auditStatus:40,//审核状态
                changeStatus:authorData.change_status//变更类型


            },
            success: function (data) {

                console.log(target.parentElement.parentElement.parentElement)
                target.parentElement.parentElement.parentElement.previousElementSibling.innerHTML = '<td><div><p class="remarkP"><a class="remarkA" href="#" style="color: #000;"></a></p></div><div><a style="margin-right: 20px"><span class="list" id="' + id + '" onclick="editor(' + id + ')">编辑</span></a></div></td>'
                target.parentElement.parentElement.parentElement.innerHTML = '';


            },
            error: function () {
                $.Huimodalalert('失败！',2000);
            }
        })}
    else{
        $.Huimodalalert('处理结果不能为空！',2000);
    };
    layer.close(index);
}
function picShow(title, url, imgUrl) {
    window.event ? window.event.cancelBubble = true : e.stopPropagation();
    sessionStorage.setItem("imgUrl", imgUrl);
    layer_show(title, url, "800", "500");
}

